import Buff from '@/Buff';
import BuffUtil from '@/BuffUtil';
import BuffCommon from 'code/Core/Common/BuffCommon';
import UnitCommon from 'code/Core/Common/UnitCommon';
import AbilityBase from 'code/Scripts/Abilities/base/AbilityBase';
/* 阳炎术 */
export default class DLY_FireOfSun extends AbilityBase {
    static instance: DLY_FireOfSun;
    buffType: AppBuffType = {
        id: 'buff_DLY_FireOfSun',
        name: this.abilityName,
        ubertip: '持续受到火焰伤害',
        art: this.art,
        interval: 1,
        onInterval: this.buffInterval.bind(this),
        dur: 12,
        targetAttach: 'overhead',
        targetArt: 'Environment\\SmallBuildingFire\\SmallBuildingFire1.mdl',
    };
    buffInterval(buff: Buff) {
        let s = buff.getCaster();
        let lv = this.getAbilityLevel(s);
        let dmg = 10 * lv + UnitCommon.取法强(s) * (0.3 + 0.2 * lv);
        DamageSystemInstance.applyFireDamage(buff.getParent(), s, dmg, this.id, true);
    }
    constructor(id: string) {
        super(id);
        DLY_FireOfSun.instance = this;
        this.init();
        se.onUnitSpellEffect(this.onSpellEffect.bind(this), this.id);
    }
    init() {
        BuffUtil.registerBuffType(this.buffType);
    }
    cast<T extends Object = any>(tarX: number, tarY: number, source: unit, target: unit, data?: T): void {
        let lv = this.getAbilityLevel(source);
        let dmg = 30 * lv + UnitCommon.取法强(source) * (0.6 + 0.3 * lv);
        if (BuffUtil.hasUnitBuff(target, this.buffType.id)) {
            dmg *= 2.5;
        }
        DamageSystemInstance.applyFireDamage(target, source, dmg, this.id);
        BuffCommon.addBuff({ target, caster: source, buffTypeId: this.buffType.id, ablityId: this.id });
    }
    onSpellEffect() {
        this.cast(GetSpellTargetX(), GetSpellTargetY(), GetTriggerUnit(), GetSpellTargetUnit());
    }
}
